<?php
session_start(); 
if(!isset($_SESSION['userName'])){
header( 'location:../index.php' ); 
} 
	include("../conf/connect.php");
	$user_id = $_SESSION['user_id'];
	$hid = $_SESSION['usrHHid'];
	$name = $_GET['name'];
	$id = $_GET['id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="../style.css" media="screen" />
	<link rel="shortcut icon" href="images/favicon.ico" />
</head>
<body class="iub_back">
	<form method="post" action="answer.php?qus=rel_detail2">
	<table align="center" class="table_border">
			
			<tr>
					<td>10. Rel Detail: <HR /></td>				
			</tr>
			
			<tr>
					<td>Father of <?php echo $name;?>:</td>				
			</tr>
			<tr>
				<td>
					<select name="fid">
					<?php
						$sql ="SELECT id,q1,q3 FROM raw_data where user_id='$user_id' and hid='$hid'";
						$result=mysql_query( $sql);
						while($row = mysql_fetch_array($result)){
						$answer=$row['q1'];
						$chkgender = $row['q3'];
						//if($chkgender == '1'){
					?>
						<option value="<?php echo $row['id'].":".$answer;?>"><?php echo $answer;?></option>
					<?php }//}?>
						<option value="Deceased">Deceased</option>
						<option value="Lives elsewhere">Lives Elsewhere</option>
						<!--<option value="0">N/A</option>-->
					</select>
				</td>
			</tr>
			<tr>
					<td>Mother of <?php echo $name;?>:</td>				
			</tr>
			<tr>
				<td>
					<select name="mid">
					<?php
						$sql ="SELECT id,q1,q3 FROM raw_data where user_id='$user_id' and hid='$hid'";
						$result=mysql_query( $sql);
						while($row = mysql_fetch_array($result)){
						$answer=$row['q1'];
						$chkgender = $row['q3'];
						//if($chkgender == '3'){
					?>
						<option value="<?php echo $row['id'].":".$answer;?>"><?php echo $answer;?></option>
					<?php }//}?>
						<option value="Deceased">Deceased</option>
						<option value="Lives elsewhere">Lives Elsewhere</option>
						<!--<option value="0">N/A</option>-->
					</select>
				</td>
			</tr>
			<?php
				$sql ="SELECT * FROM raw_data where id='$id' and  user_id='$user_id' and hid='$hid'";
				$result=mysql_query( $sql);
				$row = mysql_fetch_array($result);
				$personGender = $row['q3'];
				if($row['q4'] =='02'){
			?>
			<tr>
					<td>Spouse of <?php echo $name;?>:</td>				
			</tr>
			<tr>
				<td>
					<select name="sid">
					<?php
						$sql ="SELECT id,q1,q3 FROM raw_data where user_id='$user_id' and hid='$hid'";
						$result=mysql_query( $sql);
						while($row = mysql_fetch_array($result)){
						$answer=$row['q1'];
						$chkgender = $row['q3'];
						//if($chkgender != $personGender){
					?>
						<option value="<?php echo $row['id'].":".$answer;?>"><?php echo $answer;?></option>
					<?php }//}?>
						<option value="Deceased">Deceased</option>
						<option value="Lives elsewhere">Lives Elsewhere</option>
					</select>
				</td>
			</tr>
			
			<?php }?>
			<tr>
					<td  align="right">
						<input name='back' type='submit' value='Next' class='input-box' /><!--<input type="submit" value="Done" class="input-box" />-->
					</td>
			</tr>			
		</table>
		</form>
</body>
</html>